package com.cskaoyan.controller;


import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/wx/search")
public class WxSearchController {
    @Autowired
    SearchService searchService;

    @GetMapping("index")
    public BaseRespVo index() {
        Map<String, List> data = searchService.getIndex();
        return BaseRespVo.ok(data);
    }


    @RequestMapping("helper")
    public BaseRespVo search(String keyword ) {
        return BaseRespVo.ok(searchService.getHelper(keyword));
    }
    @RequestMapping("clearhistory")
    public BaseRespVo clear(){
        int i = searchService.clearSearchHistory();
        return BaseRespVo.ok();
    }
}
